package tree.traverse;

/**
 * @ author : HyoJoo-W
 * @ createDate : 2021-06-04 16:39
 * @ Description :
 */
public class TreeTest
{
    public static void main(String[] args)
    {
        BinaryTree binaryTree = new BinaryTree();
        TreeNode root = new TreeNode(1, "宋江");
        TreeNode node2 = new TreeNode(2, "卢俊义");
        TreeNode node3 = new TreeNode(3, "吴用");
        TreeNode node4 = new TreeNode(4, "林冲");
        TreeNode node5 = new TreeNode(5, "武松");

        root.setLeft(node2);
        root.setRight(node3);
        node3.setRight(node4);
        node3.setLeft(node5);

        binaryTree.setRoot(root);
        //System.out.println("前序遍历");
        //binaryTree.preOrder();
        //
        //System.out.println("中序遍历");
        //binaryTree.midOrder();
        //
        //System.out.println("后序遍历");
        //binaryTree.postOrder();

        System.out.println("前序查找");
        TreeNode node = binaryTree.postOrderSearch(5);
        if (node != null)
        {
            System.out.println("找到了...");
            System.out.println(node);
        }
        else
        {
            System.out.println("没有找到...");
        }
    }

}
